package com.zp.oj.judge.CodeSandBox;

import com.zp.oj.judge.model.ExecuteCodeRequest;
import com.zp.oj.judge.model.ExecuteCodeSandResponse;
import lombok.extern.slf4j.Slf4j;

/**
 * 不改变原本的接口 新建一个代理类去处理信息
 */
@Slf4j
public class CodeSandBoxProxy implements CodeSandBox{
    private final CodeSandBox codeSandBox;

    public CodeSandBoxProxy(CodeSandBox codeSandBox){
        this.codeSandBox = codeSandBox;
    }
    @Override
    public ExecuteCodeSandResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        log.info("代码沙箱请求信息" + executeCodeRequest.toString());
        ExecuteCodeSandResponse executeCodeSandResponse = codeSandBox.executeCode(executeCodeRequest);
        log.info("代码沙箱返回信息" + executeCodeSandResponse);
        return executeCodeSandResponse;
    }
}
